package com.ruoyi.house.controller;

import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.domain.AtbDistrict;
import com.ruoyi.common.service.AtbDistrictService;
import com.ruoyi.house.domain.Dto.request.ResAtbDistrict;
import com.ruoyi.house.domain.Plot;
import com.ruoyi.house.service.IAtbHouseService;
import com.ruoyi.plot.domain.AtbPlotDetail;
import com.ruoyi.plot.service.IAtbPlotDetailService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author DarkClown
 * @date 2024-09-16 12:56
 * @project_name bootLikeHome
 * @parem
 **/
@RestController
@RequestMapping("/house/City")
public class CityController {
    @Resource
    AtbDistrictService districtService;

    @Resource
    IAtbHouseService houseService;


    @GetMapping("city/{id}")
    private List<AtbDistrict> city(@PathVariable("id") Integer id){
        return  districtService.getCity(id);
    }

    @GetMapping("plotList")
    private List<Plot> plotDetailList(){
        return houseService.selectPlot();
    }

    @GetMapping("getCity/{id}")
    private AtbDistrict getCity(@PathVariable("id") Integer id){
        AtbDistrict byId = districtService.getById(id);
        ResAtbDistrict resAtbDistrict = BeanUtil.toBean(byId, ResAtbDistrict.class);
        return byId;
    }
}
